﻿namespace Signit.Sdk.Http
{
    public abstract class AbstractSignitResponse
    {
        public string Code { get; set; }
        public string Message { get; set; }

        // 自定义标识
        public string CustomTag { get; set; }

        // 服务调用唯一标识
        public string InvokeNo { get; set; }

        public bool IsSuccess
        {
            get
            {
                if (Code == null || Code.Length < 4)
                {
                    return false;
                }

                var descCode = Code.Substring(Code.Length - 4);
                return int.TryParse(descCode, out int code)
                    && code >= 0 && code < 100;
            }
        }

        public ErrorResponse Error { get; set; }
    }
}
